b=open('a.txt', 'r', encoding='utf-8')
b1=b.readlines()
print(b1)

while True:
    b2 = b.readline()
    if not b2:
        break
    print(b2)

b.seek(0)
print(b.readline())
b.close()
b=open('b.txt', 'w', encoding='utf-8')
b.write('明月几时有\n把酒问青天')
b.close()
with open("../../总结/b.txt", 'w', encoding='utf-8') as f :
    f.write('\n不知天上宫阙\n今夕是何年')

import csv
with open("sroce.csv", 'r', encoding='utf-8') as f :
    reader1=csv.reader(f)
    for reader2 in reader1:
        print(reader2,reader2[0],reader2[1])
print('----------')
with (open("sroce.csv", 'r', encoding='utf-8') as f) :
    reader1=csv.DictReader(f)
    for row in reader1:
        print(row,row.get('姓名'),row['成绩'])

with open("sroce.csv", 'a', encoding='utf-8') as f :
    reader1=csv.writer(f)
    reader1.writerow(['张三','34'])
    reader1.writerows([['小三','54'],['小四','67'],['小五','78']])

with open("sroce.csv", 'a', encoding='utf-8') as f :
    reader1=csv.DictWriter(f,fieldnames=['姓名','成绩'])
    reader1.writerow({"姓名": "mandy", "成绩": 67})
    reader1.writerows([{"姓名": "mandy1", "成绩": 67}, {"姓名": "mandy2", "成绩": 67}, {"姓名": "mandy3", "成绩": 67}])